import { reactive, ref, onMounted, watch } from "@vue/composition-api";

export function pagination() {
  const pageData = reactive({
    currentPage: 1,
    pageSizes: [10, 20, 50, 100],
    pageSize: 10,
    pageCount: 11,
    total: 0
  });

  // 统计数据总条数 代码只有一行的话可以 不用写花括号 { } 使用简写
  const handlerTotalCount = (val) => pageData.total = val;

  const handleSizeChange = (val) => pageData.pageSize = val;

  const handleCurrentChange = (val) => pageData.currentPage = val;

  return {
    pageData,
    handleSizeChange,
    handleCurrentChange,
    handlerTotalCount
  };
}
